package com.mate.cloud.uid.service.impl;

import com.mate.cloud.mybatis.bases.BasesServiceImpl;
import com.mate.cloud.uid.domain.Order;
import com.mate.cloud.uid.impl.CachedUidGenerator;
import com.mate.cloud.uid.mapper.OrderMapper;
import com.mate.cloud.uid.service.OrderService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;


@Service
public class OrderServiceImpl extends BasesServiceImpl<OrderMapper, Order> implements OrderService {


    @Resource
    private CachedUidGenerator cachedUidGenerator;


    private Long generatorUID() {
        return cachedUidGenerator.getUID();
    }

    @Override
    public int saveOrder(Order order) {
        order.setOrderId(generatorUID());
        return baseMapper.insert(order);
    }
}
